//
//  YWKLineCheatsVideoListTool.m
//  YueshengToutiao
//
//  Created by jun peng on 2022/2/10.
//  Copyright © 2022 YW. All rights reserved.
//

#import "YWKLineCheatsVideoListTool.h"

@implementation YWKLineCheatsVideoListTool

+ (void)kLineCheatsVideoListStatusesWithParameters:(YWKLineCheatsVideoListParam *)param success:(void(^)(YWKLineCheatsVideoListStatus *status))success failure:(void(^)(NSError *error))failure{
    
    
    NSString *url = [NSString stringWithFormat:@"%@/api/UserInfo/GetKxmjVideoInfo",domainURL];
    
    
    [YWHttpTool Post:url parameters:param.keyValues success:^(id responseObject) {
        
        //        YWLog(@"%@",responseObject);
                
                NSMutableDictionary *dictionary = (NSMutableDictionary *)responseObject;

                id ResultObj = dictionary[@"ResultObj"];

                if ([ResultObj isKindOfClass:[NSNull class]]) {

                    [dictionary setObject:[NSDictionary dictionary] forKey:@"ResultObj"];
                }
        
        //试用这个方法、但是最多只能将原来是string类型返回null有效、但是对于原来是NSDictionary或者array类型的返回null但是转为了@“”依然会奔溃的
        NSDictionary *dic = [NSDictionary nullDic:dictionary];
      
        YWKLineCheatsVideoListStatus *status = [YWKLineCheatsVideoListStatus objectWithKeyValues:dic] ;
        
        
        // 传递了block
        if (success) {
            success(status);
        }
        
    } failure:^(NSError *error) {
        
        if (failure) {
            failure(error);
        }
        
    }];
    
}

@end
